package com.example.spingjpajson.entity;

import com.example.spingjpajson.entity.json.DepartmentExtraJson;
import com.vladmihalcea.hibernate.type.json.JsonStringType;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

@Entity
@Data
@Table(name = "department")
@TypeDef(name = "json", typeClass = JsonStringType.class)
public class DepartmentEntity implements Serializable {
    @Id
    private String id;
    /**
     * 租户id
     */
    private String tenantId;

    /**
     * 名称;
     */
    private String name;

    /**
     * 上级id;
     */
    private String parentId;

    private LocalDateTime createTime;
    /**
     * 扩展字段
     **/
    @Type(type = "json")
    @Column(columnDefinition = "json")
    private DepartmentExtraJson extra;
    //private String extra;

}
